package ua.edu.sumdu.j2se.roman.lab1.view.console;

import ua.edu.sumdu.j2se.roman.lab1.view.EnterCommandView;

import java.util.Scanner;

/**
 * Author: Radko Roman.
 */

/**
 * This class responsible for receive from user commands (add, delete, list, close).
 *
 */
public class ConsoleEnterCommandView implements EnterCommandView {

    /**
     * Creates for reading command from the console.
     *
     */
    private Scanner scanner = null;
    /**
     * Received command from user.
     *
     */
    private String enteredCommand;

    public ConsoleEnterCommandView() {
        scanner = new Scanner(System.in);
    }

    /**
     * Ask user to enter the command, and inform controller about his choice.
     *
     */
    @Override
    public void show() {
        enteredCommand = scanner.next();
    }

    /**
     * Gets command from view.
     *
     * @return command
     */
    @Override
    public String getEnteredCommand() {
        return enteredCommand;
    }

}
